//
//  SoundHelper.m
//  Final
//
//  Created by Pibinuo on 15/12/8.
//  Copyright © 2015年 皮比诺. All rights reserved.
//

#import "SoundHelper.h"
#import <AudioToolbox/AudioToolbox.h>

@interface SoundHelper (){
    SystemSoundID sound;
}
@end


@implementation SoundHelper

- (instancetype)init
{
    self = [super init];
    if (self) {
        NSURL * url = [[NSBundle mainBundle] URLForResource:@"pullrefresh" withExtension:@"aif"];
        AudioServicesCreateSystemSoundID((__bridge CFURLRef _Nonnull)(url), &sound);
    }
    return self;
}

+(instancetype)shareSound
{
    static dispatch_once_t onceToken;
    static SoundHelper * helper;
    dispatch_once(&onceToken, ^{
        helper = [[SoundHelper alloc]init];
    });
    return helper;
}
-(void)playSound
{
    AudioServicesPlaySystemSound(sound);
}

@end
